from qcloud_cos import CosConfig
from qcloud_cos import CosS3Client


secret_id = 'AKIDV3dovpfQ9g8UddhknssswAJQSQHzW0Ua'      # 替换为用户的 secretId
secret_key = '51v7FE4kV7ZxY2NZZZS8c63utkVAjAWk'      # 替换为用户的 secretKey
region = 'ap-guangzhou'     # 替换为用户的 Region

config = CosConfig(Region=region, SecretId=secret_id, SecretKey=secret_key)
# 2. 获取客户端对象
client = CosS3Client(config)

# 上传文件
response = client.upload_file(
    Bucket='test-1320194660',
    LocalFilePath='FDNH.png',  # 本地文件的路径
    Key='FDNH.png',  # 上传到桶之后的文件名
)
print(response['ETag'])








